You are here: Trading System Programming > Reference > Classes > TimeSeries > TimeSeries Methods > time

time

The time method returns a Date object for a given index.

 

Syntax

var time(index);

Parameters

index

Numeric index for which to retrieve the value.

Return Value

Returns an instance of Date object if index is valid, otherwise, returns null.

Example

The following example demonstrates the use of time() method.

 

function calculate(beginIndex, endIndex)

{

//get the TimeSeries object instance for the symbol to which the study is attached to

var timeSeries = Chart.getTimeSeriesData(this.getAttachedSymbol());

 

if(timeSeries != null)

{

//retrieve last Value

if(timeSeries.count() > 0)

{

var lastDateValue = timeSeries.time(timeSeries.count() - 1);

}

}

}

 


Copyright © 2006-2009 ActiveTick LLC